<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

// 以下均为测试路由，待整合 
// start
// ajax get请求路由
Route::get('/coring/alltimeinfo','Admin\Coring\CoringController@alltimeinfo');
Route::get('/admin/coring/getmanagerdevices','Admin\Coring\CoringController@getManagerDevices');

Route::get('/alarm/alltimeinfo','Admin\Alarm\AlarmController@alltimeinfo');

// ajax新增回路测点信息路由
Route::post('/admin/monitordefine/addmonitor','Admin\Monitordefine\MonitordefineController@addmonitor');

// ajax留言板信息提交路由
Route::post('/admin/home/note','Admin\HomeController@note');

// Datatables报警消除单链路由
Route::get('/admin/alarm/cancel','Admin\Alarm\AlarmController@cancel');
// end

// 邮件发送规则路由
Route::get('mail/send','MailController@send');

// auth基本权限路由
Route::group(['middleware' => ['csrf']], function()
{
    Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
    // name用于redirct()->to();
    Route::post('login', 'Auth\LoginController@login');
    Route::post('register', 'Auth\RegisterController@login');
    Route::post('logout', 'Auth\LoginController@logout')->name('logout');
    Route::get('/home', 'HomeController@index')->name('home');
});

// 页面基础路由
Route::group(['prefix' => 'admin','namespace' => 'Admin', 'middleware' => ['auth', 'check.permission', 'language']],function ($router)
{
    $router->get('/','HomeController@index');// 主页
    // 留言提交路由
    // $router->post('note','HomeController@note');
    // ajax请求获取报警点数目信息
    $router->get('/home/alarmnum','HomeController@alarmnum');

    // 注: 通过下列的resource直接指向控制器
    // 地图定位界面路由
    $router->resource('location','Location\LocationController');

    // 实时监测分组路由
    $router->resource('coring','Coring\CoringController'); //实时监测主页

    // 报警响应界面路由 
    $router->resource('alarm','Alarm\AlarmController');
    // 警报消除界面路由
    // $router->resource('alarm/cancel','Alarm\AlarmController@cancel_alarm');

    // 历史查询界面路由
    $router->resource('history','History\HistoryController');

    // 回路测点定义界面路由
    $router->resource('monitordefine','Monitordefine\MonitordefineController');


    // 报警临界值设置界面路由
    $router->resource('alarmsetting','Alarmsetting\AlarmsettingController');

    Route::group(['prefix' => 'coring','namespace' => 'Coring'], function($router) {
    });
    $router->resource('permission','PermissionController');// 权限

    $router->resource('role','RoleController');// 角色

    $router->resource('user','UserController');// 后台用户

    $router->get('menu/clear','MenuController@cacheClear');// 菜单
    $router->resource('menu','MenuController');

    $router->get('setting/{lang}', 'SettingController@language');

    $router->resource('manage','Manage\ManagerController');// 用户
    Route::group(['prefix' => 'manage','namespace' => 'Manage'],function ($router)
    {

    });

    // 系统开发说明
    $router->get('systemexp/develop','Systemexp\SystemexpController@develop');
    $router->get('systemexp/guide','Systemexp\SystemexpController@guide');
});
